import request from '@/utils/request'

// 查询风险检查分页
export function pageCheck(query) {
  return request({
    url: '/risk/check/page',
    method: 'get',
    params: query,
    factoryId:true,
  })
}

// 查询风险检查列表
export function listCheck(query) {
  return request({
    url: '/risk/check/list',
    method: 'get',
    params: query,
    factoryId:true
  })
}

// 查询风险检查详细
export function getCheck(id) {
  return request({
    url: '/risk/check/info/' + id,
    method: 'get'
  })
}

// 新增风险检查
export function addCheck(data) {
  return request({
    url: '/risk/check',
    method: 'post',
    data: data,
    factoryId:true,
  })
}

// 修改风险检查
export function updateCheck(data) {
  return request({
    url: '/risk/check',
    method: 'put',
    data: data
  })
}

// 删除风险检查
export function delCheck(data) {
  return request({
    url: '/risk/check/remove/batch',
    method: 'delete',
    data
  })
}

// 导出风险检查
export function exportCheck(query) {
  return request({
    url: '/risk/check/export',
    method: 'get',
    params: query
  })
}

// 下载模板风险检查
export function downImportTemplate() {
  return request({
    url: '/risk/check/importTemplate',
    method: 'get'
  })
}

// 新增风险检查项
export function addBatchCheckItem(data) {
  let id=data&&data.length>0?data[0].checkId:'';
  return request({
    url: `/risk/checkitem/addBatch/${id}`,
    method: 'post',
    data: data,
  })
}


// 获取风险点的检查项
export function getBatchCheckItem(id) {
  return request({
    url:'/risk/checkitem/list',
    method: 'get',
    params:id,
    factoryId:true,
  })
}